<!DOCTYPE html>
<html>
<body>

<script type="text/javascript">
//地图
var map;
//地图点
var markers = [];
//查询参数

var static_set_Id = "";
var static_minTime = "";//原始数据（最大小时间）
var static_maxTime = "";//原始数据（最大时间）
var static_account = "";
var static_startTime = "";
var static_endTime = "";
var static_MinTime = "";//任务的开始时间
var static_MaxTime = "";//任务的结束时间

var static_startTime_day = "";
var static_endTime_day = "";
var static_startTime_hours = "";
var static_endTime_hours = "";
var static_timetype = 1;

/*展示上网日志分析地图*/
function showAnalysisMap(set_Id,account,startTime,endTime){
    setStaticParam(set_Id,account,startTime,endTime);
    initMapAndInternetData(set_Id,0);
}

/*设置static参数*/
function setStaticParam(set_Id,account,startTime,endTime){
    static_set_Id = set_Id;
    static_account = account;
    static_startTime = startTime;
    static_endTime = endTime;
    static_minTime = startTime;
    static_maxTime = endTime;
    static_MinTime = noNull(startTime).substr(0,10);//任务的开始时间
    static_MaxTime = noNull(endTime).substr(0,10);//任务的结束时间
}

/*加载地图和internet数据*/
function initMapAndInternetData(set_Id,flag){
    initMap();
    initInternetData(set_Id,flag);
    showValue();
}

/*构建地图*/
function initMap(){
    map = buildMap("googleMap");
    var left = document.getElementById("menu_map");//自定义工具栏 (左)
    var right = document.getElementById("menu_right");//自定义工具栏 (右)
    $("#menu_map_father").append($("#menu_map_father").html());
    $("#menu_right_father").append($("#menu_right_father").html());
    buildControl(left,"right");
    buildControl(right,"left");
}

/*清除上次加载的数据*/
function removeLastHtmlData(){
    markers = [];
    $(".internet-content-body-outside").empty();
    $(".identity-info").remove();
    $("#account").empty();
    $(".statistic-content-body").empty();
}


function initInternetData(set_Id,flag){
        var url;
        //点击分析按钮
        if(flag == 0){
            url = "/phone/queryAccountAnalysis?set_Id="+set_Id+
            "&timeType="+ 0;
        } else {
            url = "/phone/queryAccountAnalysis?set_Id="+set_Id+"&startTime="+static_startTime+"&endTime="+static_endTime+
            "&startTime_day="+static_startTime_day+"&endTime_day="+static_endTime_day+
            "&startTime_hours="+static_startTime_hours+"&endTime_hours="+static_endTime_hours+
            "&timeType="+static_timetype;
        }
        //加载地图坐标信息
        AjaxUtil.ajaxRequest(url, "json", function (positions) {
          removeLastHtmlData();
          var screenPoints = [];
            if(positions.length > 0){
                $("#internet").attr("disabled",false);//上网列表按钮可点击
                setPopoverHeight("internet",positions.length);//设置popover高度
                for(var key in positions) {
                  var mapdata = positions[key];
                  var line_time_type = noNull(mapdata.line_Time_Type);//日志类型
                  var time = noNull(mapdata.time);//停留时间
                  var stop = noNull(mapdata.stop);//停留位置
                  stop = 1;
                  var x = mapdata.x;
                  var y = mapdata.y;
                  var startTime = mapdata.startTime;//总时间段的开始时间
                  var endTime = mapdata.endTime;//总时间段的结束时间
                  //拼接上网列表
                  var internet_content = "<div class='internet-content-body' line_time_type='" + line_time_type + "'" +
                    " time="+time+" stop="+stop+" onclick='getMarkers("+ x +","+ y +")'>"+
                    "<div class='menu-map-row'>"+
                    "<div class='col-md-3'><span class='menu-map-left'><@spring.message 'phone.analysis.table.onLineTable.phone' />：</span></div>"+
                    "<div class='col-md-9'><span class='menu-map-right'>" + noNull(static_account) + "</span></div>"+
                    "</div>"+
                    "<div class='menu-map-row'>"+
                    "<div class='col-md-3'><span class='menu-map-left'><@spring.message 'phone.analysis.table.onLineTable.locationX' />：</span></div>"+
                    "<div class='col-md-9'><span class='menu-map-right'>" + noNull(mapdata.x) + "</span></div>"+
                    "</div>"+
                    "<div class='menu-map-row'>"+
                    "<div class='col-md-3'><span class='menu-map-left'><@spring.message 'phone.analysis.table.onLineTable.locationY' />：</span></div>"+
                    "<div class='col-md-9'><span class='menu-map-right'>" + noNull(mapdata.y) + "</span></div>"+
                    "</div>"+
                    "<div class='menu-map-row'>"+
                    "<div class='col-md-3'><span class='menu-map-left'><@spring.message 'phone.analysis.table.onLineTable.staytime' />：</span></div>"+
                    "<div class='col-md-9'><span class='menu-map-right'>" + mapdata.time + "<@spring.message 'phone.analysis.table.onLineTable.staytime.sec' /></span></div>"+
                    "</div>"+
                    "<div class='menu-map-row'>"+
                    "<div class='col-md-3'><span class='menu-map-left'><@spring.message 'phone.analysis.table.onLineTable.staydetial' />：</span></div>"+
                    "<div class='col-md-9'><span class='menu-map-right'>" + startTime + "<@spring.message 'phone.analysis.table.onLineTable.to' />" + endTime + "</span></div>"+
                    "</div>"+
                    "</div>";
                  $(".internet-content-body-outside:eq(0)").append(internet_content);
                 //拼接地图点信息
                 var list = mapdata.list;//停留时间段详情
                 var info_window = "<div class=''>"+
                    "<div class='menu-map-row'>"+
                    "<div class='info-window-left'><span class='menu-map-left'><@spring.message 'phone.analysis.table.onLineTable.phone' />：</span></div>"+
                    "<div class='info-window-right'><span class='menu-map-right'>" + noNull(static_account) + "</span></div>"+
                    "</div>"+
                    "<div class='menu-map-row'>"+
                    "<div class='info-window-left'><span class='menu-map-left'><@spring.message 'phone.analysis.table.onLineTable.locationX' />：</span></div>"+
                    "<div class='info-window-right'><span class='menu-map-right'>" + noNull(mapdata.x) + "</span></div>"+
                    "</div>"+
                    "<div class='menu-map-row'>"+
                    "<div class='info-window-left'><span class='menu-map-left'><@spring.message 'phone.analysis.table.onLineTable.locationY' />：</span></div>"+
                    "<div class='info-window-right'><span class='menu-map-right'>" + noNull(mapdata.y) + "</span></div>"+
                    "</div>";
                    for(var item in list){
                        var period = list[item];
                        info_window += "<div class='menu-map-row infowindow-div'>"+
                        "<div class='info-window-left'><span class='menu-map-left'><@spring.message 'phone.analysis.table.onLineTable.staytime' />：</span></div>"+
                        "<div class='info-window-right'><span class='menu-map-right'>" + period.time + "<@spring.message 'phone.analysis.table.onLineTable.staytime.sec' /></span></div>"+
                        "</div>"+
                        "<div class='menu-map-row infowindow-div'>"+
                        "<div class='info-window-left'><span class='menu-map-left'><@spring.message 'phone.analysis.table.onLineTable.staydetial' />：</span></div>"+
                        "<div class='info-window-right'><span class='menu-map-right'>" + period.startTime + "<@spring.message 'phone.analysis.table.onLineTable.to' />" + period.endTime + "</span></div>"+
                        "</div>"+
                        "</div>";
                    }
                  //创建地图坐标位置
                  var point = buildPoint(x,y);
                  screenPoints.push(point);
                  //方法提出来，info_window每个才独立
                  var height = getInfoWindowHeight(list.length);//通过内容获取弹出框宽度
                  var marker = createMark(point,info_window,time,height);
                  var labelStr = "{line_time_type:'" +line_time_type + "',time:" + time + ",stop:" + stop + "}";
                  marker.setTitle(labelStr);
                  markers.push(marker);
                }
              }
            showAllPoints(screenPoints);
            //初始化地图自定义插件
            initPopoverFirst();
            setList(set_Id);//加载 虚拟身份 行为统计 中文词组
        });
}

//加载 虚拟身份 行为统计 中文词组
function setList(set_Id){
    var url = "/phone/queryAccountStatistic?set_Id="+set_Id+"&account="+static_account+"&startTime="+static_startTime+"&endTime="+static_endTime+
                                            "&startTime_day="+static_startTime_day+"&endTime_day="+static_endTime_day+
                                            "&startTime_hours="+static_startTime_hours+"&endTime_hours="+static_endTime_hours+
                                            "&timeType="+static_timetype;
    AjaxUtil.ajaxRequest(url, "json", function (data) {
        if(data != null){
            var terminal = data.terminal; //终端信息 list
            var virtual = data.virtual;   //虚拟身份  list
            var netCurve = data.netCurve;  //24小时上网曲线  list
            var viewNum = data.viewNum;  //访问量排行  map
            var gpss = data.gps; //gps位置
            
            //终端信息
            if(terminal != null) {
                var content = "";
                for(var item in terminal) {
                    var name = noNull(terminal[item].name);
                    var virtualidentity = noNull(terminal[item].virtualidentity);
                    if(virtualidentity.indexOf(",") != -1) {
                        var strs = virtualidentity.split(",");
                        for(var i=0; i<strs.length; i++) {
                            if(i == 0) {
                                content += "<div class='menu-map-row identity-info'>" +
                                               "<div class='col-md-6'><span class='menu-map-left'>"+name+"：</span></div>" +
                                               "<div class='col-md-6'><span class='menu-map-right'>"+strs[i]+"</span></div>" +
                                           "</div>";
                            }else {
                                content += "<div class='menu-map-row identity-info'>" +
                                               "<div class='col-md-6'><span class='menu-map-left'></span></div>" +
                                               "<div class='col-md-6'><span class='menu-map-right'>"+strs[i]+"</span></div>" +
                                           "</div>";
                            }
                        }
                    }else {
                        content += "<div class='menu-map-row identity-info'>" +
                                   "<div class='col-md-6'><span class='menu-map-left'>"+name+"：</span></div>" +
                                   "<div class='col-md-6'><span class='menu-map-right'>"+virtualidentity+"</span></div>" +
                               "</div>";
                    }
                }
                $(".identity-content-body-outside").append(content);
            }
            
            $("#account").append(static_account);
            //虚拟身份
            if(virtual != null) {
                var content = "";
                for(var item in virtual) {
                    var name = noNull(virtual[item].name);
                    var virtualidentity = noNull(virtual[item].virtualidentity);
                    if(virtualidentity.indexOf(",") != -1) {
                        var strs = virtualidentity.split(",");
                        for(var i=0; i<strs.length; i++) {
                            if(i == 0) {
                                content += "<div class='menu-map-row identity-info'>" +
                                               "<div class='col-md-6'><span class='menu-map-left'>"+name+"：</span></div>" +
                                               "<div class='col-md-6'><span class='menu-map-right'>"+strs[i]+"</span></div>" +
                                           "</div>";
                            }else {
                                content += "<div class='menu-map-row identity-info'>" +
                                               "<div class='col-md-6'><span class='menu-map-left'></span></div>" +
                                               "<div class='col-md-6'><span class='menu-map-right'>"+strs[i]+"</span></div>" +
                                           "</div>";
                            }
                        }
                    }else {
                        content += "<div class='menu-map-row identity-info'>" +
                                   "<div class='col-md-6'><span class='menu-map-left'>"+name+"：</span></div>" +
                                   "<div class='col-md-6'><span class='menu-map-right'>"+virtualidentity+"</span></div>" +
                               "</div>";
                    }
                }
                $(".identity-content-body-outside").append(content);
            }
            
            var netCurve_length = 0;//上网曲线数据条数
            netCurve_data_x = [];//清除上次记录
            netCurve_data_y = [];//清除上次记录
            //24小时上网曲线
            for(var item in netCurve){
                var time = netCurve[item].time;//时间
                var total = netCurve[item].total;//人数
                netCurve_data_x[item] = time;
                netCurve_data_y[item] = total;
                netCurve_length++;
            }
            
            var viewNum_length = 0;//行为统计数据条数
            $(".statistic-content-body").html("<div><span><strong><@spring.message 'phone.analysis.table.actionStatistic.fangaccount' /></strong></span></div>");
            //行为统计
            for(var item in viewNum){
                var total = viewNum[item];//访问次数
                var viewNum_html = "";
                if(item.length > 20){
                    var item_ = item.substr(0,20)+"..";
                    viewNum_html = "<div class='statistic-div'><div class='div-left'>" + item_ + "</div><div class='div-right'>" + total + "<@spring.message 'phone.analysis.table.map.count' /></div></div>";
                }else{
                    viewNum_html = "<div class='statistic-div'><div class='div-left'>" + item + "</div><div class='div-right'>" + total + "<@spring.message 'phone.analysis.table.map.count' /></div></div>";
                }
                $(".statistic-content-body").append(viewNum_html);
                viewNum_length++;
            }
            setPopoverHeight("statistic",viewNum_length);
            
             //var gpssNum_length = 0;//gps数据条数
             for(var item in gpss){
              var data = gpss[item];
              var account = data.account;//账号
              var access_Time = data.access_Time;//访问时间
              var x = data.x;//经度
              var y = data.y;//纬度
              //创建地图坐标位置
              var point = buildPoint(x,y);
              var info_window = "<div class='' style='width:280px;'>"+
                "<div class='menu-map-row'>"+
                "<div class='col-md-3'><span class='menu-map-left'><@spring.message 'phone.analysis.table.virtualidentity.gpsapp' />：</span></div>"+
                "<div class='col-md-9'><span class='menu-map-right'>" + data.name + "</span></div>"+
                "</div>"+
                "<div class='menu-map-row'>"+
                "<div class='col-md-3'><span class='menu-map-left'><@spring.message 'phone.analysis.table.virtualidentity.phone' />：</span></div>"+
                "<div class='col-md-9'><span class='menu-map-right'>" + account + "</span></div>"+
                "</div>"+
                "<div class='menu-map-row'>"+
                "<div class='col-md-3'><span class='menu-map-left'><@spring.message 'phone.analysis.table.virtualidentity.acctime' />：</span></div>"+
                "<div class='col-md-9'><span class='menu-map-right'>" + access_Time + "</span></div>"+
                "</div>"+
                "<div class='menu-map-row'>"+
                "<div class='col-md-3'><span class='menu-map-left'><@spring.message 'phone.analysis.table.virtualidentity.Longitude' />：</span></div>"+
                "<div class='col-md-9'><span class='menu-map-right'>" + data.x + "</span></div>"+
                "</div>"+
                "<div class='menu-map-row'>"+
                "<div class='col-md-3'><span class='menu-map-left'><@spring.message 'phone.analysis.table.virtualidentity.Latitude' />：</span></div>"+
                "<div class='col-md-9'><span class='menu-map-right'>" + data.y + "</span></div>"+
                "</div>"+
                "</div>";
              var marker = createMarkGps(point,info_window,data.picturepath);
              var labelStr = "{line_time_type:'" + 1 + "',time:" + 1 + ",stop:" + 2 + "}";
              marker.setTitle(labelStr);
              markers.push(marker);
            }
        }
        initPopoverNext();
    });
}

//按时间查看重置
function timeReset(){
    var timetype1 = document.querySelectorAll("#timetype1")[1].checked;
    var timetype2 = document.querySelectorAll("#timetype2")[1].checked;
    
    if(timetype1)
    {
        document.querySelectorAll('#start_Time')[1].value = '';
        document.querySelectorAll('#end_Time')[1].value = '';
    }
    if(timetype2)
    {
        var startTime = '';
        var endTime = '';
        document.querySelectorAll('#start_Time_day')[1].value = '';
        document.querySelectorAll('#end_Time_day')[1].value = '';
        document.querySelectorAll('#start_Time_hours')[1].value = '';
        document.querySelectorAll('#end_Time_hours')[1].value = '';
    }
}



var netCurve_data_x = [];//24小时上网曲线x轴数据
var netCurve_data_y = [];//24小时上网曲线y轴数据

var internet_popover_height = "0px";//上网列表popover宽度
var statistic_popover_height = "240px";//行为统计popover宽度

function initPopoverFirst(){
    //加载上网列表
    $("#internet").webuiPopover({
      width:"500px",
      height:internet_popover_height,
      placement:"bottom-right",
      content:$(".internet-content").html(),
      trigger:"click",
      html:true
    }).webuiPopover('show');
    $("#internet").webuiPopover('hide');
    
    //加载按时间查看
    $("#timequery").webuiPopover({
      width:"450px",
      height:"190px",
      placement:"bottom-right",
      content:$(".timequery-content").html(),
      trigger:"click",
      html:true
    }).on('click',function(){
          setIcheck_query();
    });
    
    //加载查看筛选
    $("#timescreen").webuiPopover({
      width:"1100px",
      height:"190px",
      placement:"bottom-right",
      content:$(".timescreen-content").html(),
      trigger:"click",
      html:true
    }).on('click',function(){
          setIcheck_screen();
    });
}

function initPopoverNext(){
    //加载行为统计
    $("#statistic").webuiPopover({
      width:"300px",
      height:statistic_popover_height,
      placement:"bottom-right",
      content:$(".statistic-content").html(),
      trigger:"click",
      html:true
    }).on('click',function(){
        setTimeout("setEcharts()",200);
    });
    
    //加载虚拟身份
    $("#identity").webuiPopover({
      width:"300px",
      height:"220px",
      placement:"bottom-left",
      content:$(".identity-content").html(),
      trigger:"click",
      html:true
    });
    
      $("#gps").webuiPopover({
      width:"300px",
      height:"220px",
      placement:"bottom-right",
      content:$(".gps-content").html(),
      trigger:"click",
      html:true
    });
    allButtonEnabled();
}

//渲染单选复选按钮--时间查看
function setIcheck_query(){
   for(var i = 2;i<=3;i++){
       var $item = $('input.skin-flat-timequery:eq('+i+')');
       $item.iCheck('destroy');
       $item.iCheck({
       checkboxClass: 'icheckbox_flat-blue',
       radioClass: 'iradio_flat-blue'
     }).on('ifChanged',function(event){
      if($('.timetype1:eq(1)').is(':checked')){
          static_timetype = 1;
          $(".shiduan:eq(1)").hide();
          $(".shijian:eq(1)").show();
      }
      if($('.timetype2:eq(1)').is(':checked')){
          static_timetype = 2;
          $(".shiduan:eq(1)").show();
          $(".shijian:eq(1)").hide();
      }
    }); 
   }
}

//渲染单选复选按钮--时间查看
function setIcheck_screen(){
    for(var i = 9;i<=17;i++){
     var $item = $('input.skin-flat:eq('+i+')');
     $item.iCheck('destroy');
     $item.iCheck({
        checkboxClass: 'icheckbox_flat-blue',
        radioClass: 'iradio_flat-blue'
      }).iCheck('update');
    }
}

//重新绘制24小时上网曲线
function setEcharts(){
    var dom = document.querySelectorAll(".echarts");//获取折线图div
    var myChart = echarts.init(dom[1],"macarons");
      var option = {
        title:{
          text:'<@spring.message "phone.analysis.table.actionStatistic.qu24h" />'
        },
        tooltip:{
            trigger:'axis'
        },
        grid:{
            left:'2%',
            right:'2%',
            bottom:'2%',
            containLabel:true
        },
        xAxis:{
          type:'category',
          data:netCurve_data_x
        },
        yAxis:{
          type:'value'
        },
        series:[{
            name:'上网活跃',
            type:'line',
            itemStyle:{
              normal:{
                lineStyle:{
                  //color:'#00ff00'
                }
              }             
            },
            data:netCurve_data_y
        }]
      };
      myChart.setOption(option);
}

//临时存储最后一个infoWindow
var lastInfoWindow;

//初始化地图坐标位置和图标
function createMark(point,info_html,time,height) {
    var icon = choseIconStyle(time);
    var marker = buildMarkerByPoint(point,icon);
    var message = new google.maps.InfoWindow({  
      content : info_html,
      size : new google.maps.Size(500, height)
    });
    google.maps.event.addListener(marker, 'click', function() {  
      closeLastInfoWindow(message);
      message.open(map, marker);
      cleanAllIconCss();//还原所有icon的样式
      marker.setIcon(marker_red);
      mapSetCenter(marker);
    });
    return marker;
}

//初始化地图坐标位置和图标--gps
function createMarkGps(point,info_html,picture) {
  var icon = "/picture/gps/" + picture;
  var marker = buildMarkerByPoint(point,icon);
  var message = new google.maps.InfoWindow({  
    content : info_html,
    size : new google.maps.Size(500, 400)
  });
  google.maps.event.addListener(marker, 'click', function() {
    closeLastInfoWindow(message);
    message.open(map, marker);
    cleanAllIconCss();//还原所有icon的样式
    mapSetCenter(marker);
  });
  return marker;
}

/*关闭上一个infowindow*/
function closeLastInfoWindow(message){
    if(lastInfoWindow != undefined){
        lastInfoWindow.close();
    }
    lastInfoWindow = message;
}

/*设置地图中心点*/
function mapSetCenter(marker){
    map.panTo(marker.getPosition());
}


//按时间查看提交按钮
function timeSubmit(){
    var startTime = '';
    var endTime='';
    
    var start_time_day = '';
    var end_time_day = '';
    var start_time_hours = '';
    var end_time_hours = '';
    if(static_timetype == 1)
    {
        startTime = document.querySelectorAll('#start_Time')[1].value;
        endTime = document.querySelectorAll('#end_Time')[1].value;
    }
    if(static_timetype == 2)
    {
        start_time_day = document.querySelectorAll('#start_Time_day')[1].value;
        end_time_day = document.querySelectorAll('#end_Time_day')[1].value;
        start_time_hours = document.querySelectorAll('#start_Time_hours')[1].value;
        end_time_hours = document.querySelectorAll('#end_Time_hours')[1].value;
        
        if(start_time_day == '' || end_time_day == '' || start_time_hours == '' || end_time_hours == ''){
            layer.msg('<@spring.message 'phone.analysis.table.asTimeCheck.asTimeQuantumCheck.log' />');
            return;
        }
        
        //限制时间段
        var days = (Date.parse(end_time_day)-Date.parse(start_time_day))/86400000 + 1;//获得中间相差几天
        if(days>180){
            layer.msg('<@spring.message 'phone.analysis.table.asTimeCheck.asTimeQuantumCheck.log1' />');
            return;
        }
    }
    static_startTime = startTime;
    static_endTime = endTime;
    static_startTime_day = start_time_day;
    static_endTime_day = end_time_day;
    static_startTime_hours = start_time_hours;
    static_endTime_hours = end_time_hours;
    
    webuiPopoversHide();
    initMapAndInternetData(static_set_Id,1);
}

//筛选重置
function timescreenreset(){
    $('input.skin-flat').iCheck('check');
}

//筛选提交
function timescreensubmit()
{
    var logtype1 = document.querySelectorAll("#logtype1")[1].checked;//上线日志
    var logtype2 = document.querySelectorAll("#logtype2")[1].checked;//下线日志
    var logtype3 = document.querySelectorAll("#logtype3")[1].checked;//访问日志
    
    var time1 = document.querySelectorAll("#time1")[1].checked;//大于4小时
    var time2 = document.querySelectorAll("#time2")[1].checked;//小于1小时
    var time3 = document.querySelectorAll("#time3")[1].checked;//大于30分钟
    var time4 = document.querySelectorAll("#time4")[1].checked;//小于30分钟
    
    var stop1 = document.querySelectorAll("#stop1")[1].checked;//基站
    var stop2 = document.querySelectorAll("#stop2")[1].checked;//经纬度
    
    //对地图上的点进行筛选
    for(var i in markers)
    {
        var marker = markers[i];
          var sign1 = false;//日志类型显示标识
          var sign2 = false;//停留时间显示标识
          var sign3 = false;//停留位置显示标识
          markerHide(marker);
          var label = marker.getTitle();
          var json = eval("(" + label + ")");
          var line_time_type = json.line_time_type;//日志类型
          var time = json.time;//停留时间
          var stop = json.stop;//停留位置
          
          //如果是滴滴  （经纬度）
          if(stop == 2 && stop2)
          {
              markerShow(marker);
              continue;
          }   
          
          if(logtype1&logtype2&logtype3)
          {
              sign1 = true;
          }else
          {
            if(logtype1 && (line_time_type.indexOf('1') != -1))
                sign1 = true;
            if(logtype2 && (line_time_type.indexOf('2') != -1))
                sign1 = true;
            if(logtype3 && ((line_time_type.indexOf('0') != -1) || (line_time_type.indexOf('3') != -1) || (line_time_type.indexOf('9') != -1)))
                sign1 = true;
          }
          
          if(time1&time2&time3&time4)
          {
              sign2 = true;
          }else
          {
            if(time1 && time>=14400)
                sign2 = true;
            if(time2 && time>=3600 && time<14400)
                sign2 = true;
            if(time3 && time>=1800 && time<3600)
                sign2 = true;
            if(time4 && time<1800)
                sign2 = true;
          }
          
          if(stop1&stop2)
          {
            sign3 = true;  
          }else
          {
            if(stop1 && stop == 1)
              sign3 = true;
            if(stop2 && stop == 2)
              sign3 = true;
          }
          
          if(sign1&sign2&sign3)//3项全都命中
              markerShow(marker);
    }
    
    //对左侧列表进行筛选
    var content_body = $("div.internet-content-body");
    var showcount = 0;//显示条数
    for(var i = 0;i<content_body.length;i++)
    {
        var item = $(content_body[i]);
        item.hide();
        var line_time_type = item.attr('line_time_type');//日志类型
        var time = item.attr('time');//停留时间
        var stop = item.attr('stop');//停留位置
        
        var sign1 = false;//日志类型显示标识
        var sign2 = false;//停留时间显示标识
        var sign3 = false;//停留位置显示标识
        
        if(logtype1&logtype2&logtype3)
          {
              sign1 = true;
          }else
          {
            if(logtype1 && (line_time_type.indexOf('1') != -1))
              sign1 = true;
            if(logtype2 && (line_time_type.indexOf('2') != -1))
              sign1 = true;
            if(logtype3 && ((line_time_type.indexOf('0') != -1) || (line_time_type.indexOf('3') != -1) || (line_time_type.indexOf('9') != -1)))
              sign1 = true;
          }
          
          if(time1&time2&time3&time4)
          {
              sign2 = true;
          }else
          {
            if(time1 && time>=14400)
                sign2 = true;
            if(time2 && time>=3600 && time<14400)
                sign2 = true;
            if(time3 && time>=1800 && time<3600)
                sign2 = true;
            if(time4 && time<1800)
                sign2 = true;
          }
          
          if(stop1&stop2)
          {
            sign3 = true;  
          }else
          {
            if(stop1 && stop == 1)
              sign3 = true;
            if(stop2 && stop == 2)
              sign3 = true;
          }
          
          if(sign1&sign2&sign3)//3项全都命中
          {
            item.show();
            showcount++;
          } 
    }
    
    $("#internet").attr("disabled",false);
    //根据条数自适应高度
    if(showcount == 0)
    {
        $("#internet").attr("disabled","disabled");
    }else{
        setPopoverHeight("internet",showcount/2);
        //销毁popover 重新调整高度
        $("#internet").webuiPopover("destroy");
        $("#internet").webuiPopover({
          width:"430px",
          height:internet_popover_height,
          placement:"bottom-right",
          content:$(".internet-content").html(),
          trigger:"click",
          html:true
        });
    }
}

function markerShow(marker){
    marker.setMap(map);
}

function markerHide(marker){
    marker.setMap(null);
}

function getInfoWindowHeight(length){
    var length_ = 150;
    if(length == 1)
      length_ = 130;
    else if(length == 2)
      length_ = 180;
    else if(length == 3)
      length_ = 230;
    else
      length_ = 300;
    return length_;
}

//还原所有icon的样式
function cleanAllIconCss(){
  for(var i in markers){
    var marker = markers[i];
    if(marker_red == marker.getIcon()){
      //还原原来点的颜色
      var label = marker.getTitle();
      var json = eval("(" + label + ")");
      var time = json.time;//停留时间
      var icon = choseIconStyle(time);
      marker.setIcon(icon);
    }
  }
}

//找点  
function getMarkers(x,y){
  for(var i in markers){
    var marker = markers[i];
    var point = new buildPoint(x,y);
    var position = marker.getPosition();
    if(point.equals(position)) {
      new google.maps.event.trigger(marker, 'click');
    }
  }
}

//根据时间设置marker的颜色
function choseIconStyle(time)
{
    var icon;
    if(time>=14400)
    {
        icon = marker_black;
    }else if(time>=3600)
    {
        icon = marker_dark;
    }else if(time>=1800)
    {   
        icon = marker_default;
    }else
    {   
        icon = marker_light;
    }
    return icon;
}

//回显时间查询数据
function showValue(){
    $("input[name='start_Time']").attr("value",static_startTime);
    $("input[name='end_Time']").attr("value",static_endTime);
    $("input[name='start_Time_day']").attr("value",static_startTime_day);
    $("input[name='end_Time_day']").attr("value",static_endTime_day);
    $("input[name='start_Time_hours']").attr("value",static_startTime_hours);
    $("input[name='end_Time_hours']").attr("value",static_endTime_hours);
    if(static_timetype == 2){
        $(".timetype2").attr('selected','selected');
        $(".shiduan:eq(1)").show();
        $(".shijian:eq(1)").hide();
        timescreenreset();
    }   
}

//地图加载完毕之前，所有按钮置灰
function allButtonDisabled(){
    $("#internet").attr("disabled","disabled");
    $("#statistic").attr("disabled","disabled");
    $("#identity").attr("disabled","disabled");
    $("#timequery").attr("disabled","disabled");
    $("#timescreen").attr("disabled","disabled");
}

//地图加载完毕，所有按钮可用
function allButtonEnabled(){
    $("#statistic").attr("disabled",false);
    $("#identity").attr("disabled",false);
    $("#timequery").attr("disabled",false);
    $("#timescreen").attr("disabled",false);
}

//设置popover高度
function setPopoverHeight(val,length){
    if(val == "internet")
    {
        if(length == 1)
            internet_popover_height = "140px";
        else if(length == 2)
            internet_popover_height = "280px";
        else 
            internet_popover_height = "400px";
    }
    else if(val == "statistic")
    {
        if(length == 0)
            statistic_popover_height = "280px";
        else if(length < 5)
            statistic_popover_height = "340px";
        else 
            statistic_popover_height = "420px";
    }
}
</script>

</body>
</html>